package com.pyk.controller;

import com.pyk.entity.QuestionType;
import com.pyk.entity.Result;
import com.pyk.service.QuestionTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/questiontype")
public class QuestionTypeController {
    @Autowired
    private QuestionTypeService questionTypeService;

    @PostMapping("/add")
    public Result add(@RequestBody QuestionType questionType) {
        questionTypeService.add(questionType);
        return Result.success("添加题目成功");
    }

    @PutMapping("/update")
    public Result update(@RequestBody QuestionType questionType) {
        questionTypeService.updateById(questionType);
        return Result.success("修改题目成功");
    }

    @GetMapping("/find")
    public Result<QuestionType> find(@RequestParam int id) {
        return Result.success(questionTypeService.findById(id));
    }



}
